How to Generate Authroization Code

Before you can update your Partner Credentials in your Azure Portal, you must already have an username and an auth code. If you haven't got an auth token, or you've forgotten it, or you're not sure, you can create a new auth token. You only see the auth token string when you create it, so be sure to copy the auth token to a secure location immediately.

To create/generate a new auth code:

  1. Open a browser (either in Incognito/Private mode).
  2. Access the url (https://login.microsoftonline.com/<<csp domain>>/oauth2/authorize?client_id=<<client_id>> &response_type=code&redirect_uri=<<redirect_uri>>&response_mode=query&resource=https://api.partnercenter.microsoft.com&state=12345
    • Replace <<csp domain>> with csp domain.

    • Replace <<client_id>> with NativeAppID added in the partner credentials.

    • Replace <<redirect_uri>>with the url where the authoization code will be sent back in browser.

      Example: http://localhost:8080

      Steps to find the<<csp domain>>and <<client_id>>from partnercenter portal.
      • Open http://partnercenter.microsoft.com/ in new incognito window in any browser.
      • Click on Dashboard.
      • Login with csp admin credentials.
      • Click the Settings icon (top right second icon)

      • Click Partner Settings link under Settings.
      • Click on App Management.
      • Capture Domain value. This value need to replace with <<csp domain>>in the url.

      • Capture Native App ID value. This value need to replace with <<client_id>>in the url.

  3. Obtain Redirect URI.
    • Login to azure portal using the partner user admin agent.

    • Click on Azure Active Directory.

    • Click on App Registrations.

    • Search in All Apps with Native App ID. (Follow the steps to find Native App ID).

    • Click on Display Name of the App.
    • Click on Settings.
    • Click on Redirect URLs and capture the Redirect URI and use it in Authroization code generation URL.

    • Use https://localhost:8080 for redirect_url.

      After replacing the values, sample authorization code url as given below:

      Sample url:

      https://login.microsoftonline.com/cspsandbox25.onmicrosoft.com/oauth2/authorize?client_id=4623ca39-e9fa-4f7e-8334-d5add4c71422&response_type=code&redirect_uri=http://localhost:8080&response_mode=query&resource=https://api.partnercenter.microsoft.com&state=12345

      Singout from csp portal after URL is constucted. And close the browser.

    • Now open new incognito/private browser window.

    • Once the url is constucted, copy the url in browser. You will be redirect to sign-in page.

    • In the sign-in page enter the partner center admin user credentials (CSP admin agent user) and click Next.

      After sign-in, authorization code will be sent back to entered redirect_uri.

    • Copy the url in the browser:

      Example:

      http://localhost:8080/?code=AQABAAIAAACEfexXxjamQb3OeGQ4GugviODwY4_IIR55HQ_T0ePZdJ7b8YKr4nAoaOO84fC4pihKlf7c-FRPsolLcwoUyQUnceEbE81xg8qnMg2qDgwn29ozcluaVEeC47Xf-kDq_mb19_skS0ZkyKIHZaChcvbgrsxkQ-tIM4ZjN9Rp_XgO8VtSHCrLk1iZfaur3y0FHr48VjpMZZkwpGL45vU_HAycgH1zvz6Gx5vvjXXtwx2QzSh6rxuMvKYxI4kUyPtc_-GH-IIZkCpxb356ZB4AbkYT5c7C-E7koKtMSuIngjv-PdBPQ8C1XWotcgS31Gp8vWArs_qQEX0XHUgzEJHhUNvm8apg9pRv2ZS8R5pgNngW4Dkrms5ELN8O9u_iKrKriszawdPUavf6UtkRf8pSZgvYTO2DdXj9otkkRWYnL8_k018UMr0Opvm62wCfQm7FjSUXkWVLsK_CPceMfKKeiUttvkYp2h4EoD8kb2_XbMbRVeERuwfb_S-77rl3shF6F6WezzWmsFUT5Qt0MEHG7FB7vLhypL-56rbqT0oHr9Pyy9D_zciH9g4o1oQlx01vohk049r_0gPQv_yPiQFmk3QBIAA&state=12345&session_state=1d7b2681-6a60-40ef-a649-8303377231bd

    • From the above url copy only the code and give this as Authorization Code in JSDN Partner Credentials for MSCP services.

      Example:

      AQABAAIAAACEfexXxjamQb3OeGQ4GugviODwY4_IIR55HQ_T0ePZdJ7b8YKr4nAoaOO84fC4pihKlf7c-FRPsolLcwoUyQUnceEbE81xg8qnMg2qDgwn29ozcluaVEeC47Xf-kDq_mb19_skS0ZkyKIHZaChcvbgrsxkQ-tIM4ZjN9Rp_XgO8VtSHCrLk1iZfaur3y0FHr48VjpMZZkwpGL45vU_HAycgH1zvz6Gx5vvjXXtwx2QzSh6rxuMvKYxI4kUyPtc_-GH-IIZkCpxb356ZB4AbkYT5c7C-E7koKtMSuIngjv-PdBPQ8C1XWotcgS31Gp8vWArs_qQEX0XHUgzEJHhUNvm8apg9pRv2ZS8R5pgNngW4Dkrms5ELN8O9u_iKrKriszawdPUavf6UtkRf8pSZgvYTO2DdXj9otkkRWYnL8_k018UMr0Opvm62wCfQm7FjSUXkWVLsK_CPceMfKKeiUttvkYp2h4EoD8kb2_XbMbRVeERuwfb_S-77rl3shF6F6WezzWmsFUT5Qt0MEHG7FB7vLhypL-56rbqT0oHr9Pyy9D_zciH9g4o1oQlx01vohk049r_0gPQv_yPiQFmk3QBIAA

      Capture redirect_uri given in authorization url.

    These authorization code and redirect_uri need to be updated in JSDN partner credentials for MSCSP SAAS or Azure CSP service.

    If the Partner Credentials are configured at Marketplace level, then follow the below steps:
    1. Login to marketplace as marketplace admin.
    2. Navigate to Administration and Service management > click the Edit Partner Credentials icon of any MSCSP SAAS service or Azure CSP service.

    3. Ener the captured Authroization Code and Redirect URI and click Save.
    If the Partner Credentails are configured at Store level, then follow the below steps:
    1. Login to marketplace as store admin.
    2. Navigate to Catalog > click the Edit Partner Credentials icon of any MSCSP SAAS service or Azure CSP service.

    3. Enter captured Authorization Code and Redirect URI and click Save.